//
//  CLTabBarController.swift
//  CLEasyBBQ
//
//  Created by simon zhao on 2017/4/5.
//  Copyright © 2017年 simon zhao. All rights reserved.
//

import UIKit

class CLTabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        

        // Do any additional setup after loading the view.
        let orderVc = CLOrderListViewController()
        orderVc.tabBarItem.image = UIImage.init(named: "order_bar_normal")?.withRenderingMode(.alwaysOriginal)
        orderVc.tabBarItem.selectedImage = UIImage.init(named: "order_bar")?.withRenderingMode(.alwaysOriginal)
        orderVc.tabBarItem.title = "订单"
        let NavOrderVc :CLNavigationController = CLNavigationController.init(rootViewController: orderVc)
        
        let MineVc = CLMineViewController()
        MineVc.tabBarItem.image = UIImage(named:"mine_bar_normal")?.withRenderingMode(.alwaysOriginal)
        MineVc.tabBarItem.selectedImage = UIImage(named:"mine_bar")?.withRenderingMode(.alwaysOriginal)
        MineVc.tabBarItem.title = "我的"
        let NavMineVc :CLNavigationController = CLNavigationController.init(rootViewController: MineVc)
        
        self.setTabTitle()
        
        self.viewControllers = [NavOrderVc,NavMineVc]
        
    }
    
    func setTabTitle() {
        
        var normalAttrs : [String:Any] = Dictionary()
        normalAttrs[NSFontAttributeName] = UIFont.systemFont(ofSize: 12)
        normalAttrs[NSForegroundColorAttributeName] = UIColor.gray
        
        var selAttrs : [String:Any] = Dictionary()
        selAttrs[NSFontAttributeName] = UIFont.systemFont(ofSize: 12)
        selAttrs[NSForegroundColorAttributeName] = globalColor
        
        let item = UITabBarItem.appearance()
        item.setTitleTextAttributes(normalAttrs, for: .normal)
        item.setTitleTextAttributes(selAttrs, for: .selected)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}

